# -*- coding: utf-8 -*-

from mtl.op_alloc import *
from mtl.op_exec import *
from mtl.op_tran import *
from mtl.op_utils import *


def maru_main():
    dq(addr=0, data=100)
    dq(addr=1, data=7)
    dq(addr=2, data=77)
    dq(addr=10, data=2+5j)

    ld(pid=mtl_pid(0), dst=0, src=0)  # [0] -> 100
    ld(pid=mtl_pid(0), dst=1, src=1)  # [1] -> 7
    ld(pid=mtl_pid(0), dst=2, src=2)  # [2] -> 77
    ld(pid=mtl_pid(0), dst=3, src=10) # [3] -> 2+5j

    # [4] = [0] + [1]
    mul(pid=mtl_pid(0), alu=mtl_alu(0), dst=4, src0=0, wait0=True, src1=1, wait1=True)
    # [5] = [4] + [3]
    add(pid=mtl_pid(0), alu=mtl_alu(0), dst=5, src0=4, src1=3, wait1=True)

    halt()